home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
diskutil
/
uneekit.zoo
/
uneekit.c
next >
Wrap
Text File
|
1990-12-10
|
2KB
|
58 lines
/* uneekit.c -- a programme to stamp a new, random, serial number on an Atari
diskette. This is specifically for diskettes formatted under MS-DOS, since
TOS gets confused by their lack of unique serial numbers.
Ivan D Reid, Untersiggenthal CH 9/12/1990
ivan@cageir5a.bitnet 20550::ivan ivan@cvax.psi.ch
*/
#include <osbind.h>
int buff[1024];
long filler;
main()
{ register int i;
register long status;
register char c;
for(;;) /* loop so we can fix more than one disk */
{ filler=0;
for (i=0; i<1024; i++)
buff[i] = 0xdead; /* fill up array with noticeable pattern */
i= (Random() & 0x1FL) | '@'; /* random character */
Cconws("\033E\033e Insert diskette into drive A.\15\12 Press the <");
Cconout(i); /* just a little extra to make sure he's thinking */
Cconws("> key when ready or <Esc> to quit...");
do
c=Crawcin()&0x5f;
while (c != 0x1b && c != i); /* look for the right key */
if (c == 0x1b)
break; /* he wants out... */
Cconws("\15\12 ");
status = Floprd(buff,filler,0,1,0,0,1); /* attempt a read */
if (status)
Cconws("Error reading boot sector!");
else
{ i=0;
while ((buff[i] != 0xdead) && (i<1024))
i++; /* see how much we read */
if (i != 256)
Cconws("Non-standard sector -- no action.");
else
{ Protobt(buff,0x1ffffffL,-1,-1); /* random SN */
if (Flopwr(buff,filler,0,1,0,0,1)) /* write boot sector */
Cconws("Error writing boot sector. Check write-protection!\15\12");
else
Cconws("Diskette now has random serial number.");
}
}
Cconws("\15\12 Press any key to continue (<Esc> quits)...");
if ((Crawcin()&0x7f)==0x1b)
break; /* same deal as above */
}
Cconws("\33f"); /* turn off cursor */
exit(0); /* by-bye */
}
ə